package com.cike.productmanager.util;

import java.util.ArrayList;

import android.app.Application;

import com.cike.productmanager.adt.AActivity;
import com.cike.productmanager.adt.ContactWay;
import com.cike.productmanager.adt.Contract;
import com.cike.productmanager.adt.DisplayGuide;
import com.cike.productmanager.adt.Store;
import com.cike.productmanager.adt.User;
import com.cike.productmanager.adt.taskFeedback;
import com.cike.productmanager.adt.taskUnit;

public class DataApplication extends Application{
	
	public static DataApplication MyApp;
	
	
	public static String savepath = "/sdcard/ProductManager/";
	
	public static User currentUser;																//当前的使用用户
	
	public static ArrayList<Store> storeList;											//门店列表
	
	public static ArrayList<taskUnit> activityList;									//活动列表
	public static ArrayList<taskUnit> contractList;									//合同列表
	
	public static ArrayList<taskFeedback>	activityFeedbackList;		//活动反馈列表
	public static ArrayList<taskFeedback>	contractFeedbackList;	//合同反馈列表
	
	public static ArrayList<ContactWay> contactwayList; 					//联系人列表
	
	public static ArrayList<DisplayGuide> displayGuideList; 				//陈列指引列表
	
	
	@Override
	public void onCreate() {
		// TODO Auto-generated method stub
		super.onCreate();
	}

	public static void Init(){
		
		//TODO 还有服务器地址数据要写入，用键值对的容器存最好
		
		//初始化用户
		currentUser = new User();
		//初始化几个数组
		storeList = new ArrayList<Store>();
		activityList = new  ArrayList<taskUnit>();
		contractList= new  ArrayList<taskUnit>();
		activityFeedbackList = new ArrayList<taskFeedback>();
		contractFeedbackList = new ArrayList<taskFeedback>();
		contactwayList = new ArrayList<ContactWay>();
		displayGuideList = new ArrayList<DisplayGuide>();
	}
	
	public static void RemoveDataAll(){
		
		//解除列表绑定
		currentUser = null;
		storeList = null;
		activityList = null;
		contractList= null;
		activityFeedbackList = null;
		contractFeedbackList = null;
		contactwayList = null;
	}
	
	
	//从数据库读取所有List数据
	public static void loadListfromDB(){
		loadStoreList();
		loadactivityList();
		loadcontractList();
		loadactivityFeedbackList();
		loadcontractFeedbackList();
		loadcontactwayList();
		loaddisplayGuideList();
	}
	
	
	public static void loadStoreList(){
		//TODO 读取数据库中所有门店的列表
		
		storeList.add(new Store(123, "世博超市", "12345", "广东", "广州", "番禺", "中环东路", "超市"));
	}
	public static void loadactivityList(){
		//TODO 读取数据库中所有活动的列表
		
		activityList.add(new AActivity(4321, 2, 20130312, 20130313, 1, 321, 123, "世博超市", null, "新学期促销", 10, "100件", "要求要求"));
	}
	public static void loadcontractList(){
		//TODO 读取数据库中所有合同的列表
		contractList.add(new Contract(5432, 1, 20130311, 20130312, 2, 321, 123, "世博超市", null, "新学期合同", "一般类型", "什么来的....."));
	}
	public static void loadactivityFeedbackList(){
		//TODO 读取数据库中所有历史--------------活动-------------------反馈的列表
	}
	public static void loadcontractFeedbackList(){
		//TODO 读取数据库中所有历史--------------合同-------------------反馈的列表
	}
	public static void loadcontactwayList(){
		//TODO 读取数据库中所有门店联系方式的列表
	}
	public static void loaddisplayGuideList(){
		//TODO 读取数据库中所有陈列指引方式的列表
	}
	
	
	
}
